
#ifndef OPERONDB_HEADER
#define	OPERONDB_HEADER

#include <stdio.h>
#include <db.h>

#ifdef	__cplusplus
extern "C" {
#endif
#include "core/operon.h"

/**
 * a Database in operon
 */
typedef struct OperonDB_t {
	/** the berkeley database first argument so you can cast this to (DB*)*/
	DB *db;
	/** operon owner */
	OperonPtr owner;
	/** open this */
	int (*_openTxn)(struct struct OperonDB_t* ptr,DB_TXN *txnid,u_int32_t  flags);
	/** simple open this */
	int (*open)(struct struct OperonDB_t* ptr);
	/** close this */
	int (*close)(struct struct OperonDB_t* ptr);
	/** return 1 is the database is open */
	int (*isOpen)(const struct OperonDB_t* ptr);
	/** @return a description of this database */
	const char* (*describe)(const struct ${db.typedef}* ptr);
	/** @return the filename of this database */
	const char* (*filename)(const struct ${db.typedef}* ptr);
	/** @return the databasename of this database (if multiple db) may be null */
	const char* (*datasename)(const struct ${db.typedef}* ptr);
	/** @return the open method of this database (eg. BTREE) */
	const int* (*method)(const struct ${db.typedef}* ptr);
	} OperonDB, *OperonDBPtr;

/**
 * initialize the content of an OperonDBPtr
 */
extern int initOperonDB(OperonDBPtr ptr,OperonPtr operon);


#ifdef	__cplusplus
}
#endif

#endif	/* OPERON_HEADER */
